package com.treehouse.northlight.core;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.treehouse.northlight.screen.MainMenuScreen;

public class Northlight extends Game {

	private Screen[] screens;

	private SpriteBatch spriteBatch;

	private Camera orthoCamera;

	public Northlight() {
		this.screens = new Screen[5];
		this.screens[0] = new MainMenuScreen(this);
	}

	/**
	 * @return screens as Screen[]
	 */
	public Screen[] getScreens() {
		return screens;
	}

	/**
	 * @return spriteBatch as SpriteBatch
	 */
	public SpriteBatch getSpriteBatch() {
		return spriteBatch;
	}

	/**
	 * @return orthoCamera as Camera
	 */
	public Camera getOrthoCamera() {
		return orthoCamera;
	}

	@Override
	public void create() {
		this.spriteBatch = new SpriteBatch();
		this.orthoCamera = new OrthographicCamera(Gdx.graphics.getWidth(),
				Gdx.graphics.getHeight());
		((OrthographicCamera) this.orthoCamera).setToOrtho(true);
		setScreen(this.screens[0]);
	}

	public static void main(String[] args) {
		LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
		config.fullscreen = false;
		config.width = 800;
		config.height = 600;
		config.resizable = false;
		config.title = "Engine Test v0.1";
		config.vSyncEnabled = false;
		config.useCPUSynch = false;

		LwjglApplication app = new LwjglApplication(new Northlight(), config);
		app.setLogLevel(2);
	}

	/**
	 * @see com.badlogic.gdx.Game#dispose()
	 */
	@Override
	public void dispose() {
		this.screens[0].dispose();
	}
}
